﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Domain.Model;
using System.ComponentModel.DataAnnotations;

namespace Resto.CostControl.Core.Facade.SupplierModule.DataTransferObject
{
    /// <summary>
    /// 供应商DTO
    /// </summary>
    [Serializable]
    public class SupplierDTO
    {
        #region 构造函数

        public SupplierDTO() { }

        internal SupplierDTO(Supplier supplier)
        {
            this.ID = supplier.ID;
            this.Code = supplier.Code;
            this.Name = supplier.Name;
            this.Address = supplier.Address;
        }

        #endregion

        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 供应商编号
        /// </summary>
        [Display(Name = "供应商编号")]
        public string Code { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        [Display(Name = "供应商名称")]
        public string Name { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [Display(Name = "地址")]
        public string Address { get; set; }

        #endregion

        #region 方法

        internal Supplier ToSupplier()
        {
            Supplier supplier = new Supplier();
            CopyToSupplier(supplier);
            return supplier;
        }

        internal void CopyToSupplier(Supplier supplier)
        {
            supplier.Name = this.Name;
            supplier.Code = this.Code;
            supplier.Address = this.Address;
        }

        #endregion
    }
}
